<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

session_start();
if(!isset($_SESSION["Member_Info"]) || !is_object($_SESSION["Member_Info"]))return;
if($_COOKIE["Member_CKey"] != $_SESSION["Member_Info"] -> CKey)return;

include_once(__Language_Path."/lang_member/thesame_1.lang.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/todaygame/Gamble".$_data["LottoID"].".inc.php");
include_once(__Common_Path."/gambletype/GambleType".$_SESSION["Member_Info"] -> GambleType."_".$_data["LottoID"].".inc.php");

//是否顯示球的賠率
$isShow = true;

//取得 TodayGame 資料
$arrBType = explode(",", $_data["Bet_Type"]);
foreach($arrBType as $strBT){
	include(__Common_Path."/todaygame/TodayGame".$_data["LottoID"]."_".$strBT.".inc.php");
}

//取得樂透相關資料
$isShowScore = false;
$NowDate = date("Y-m-d");
$NowTime = date("H:i:s");

//取的 Gamble 設定資料
if(!is_array($_arrGamble)){
	$isShow = false;
	$intGTime = 0;
}else{
	list($intGID, $arrGData) = each($_arrGamble);
	
	if($arrGData["GameDate"] == $NowDate && $NowTime > $arrGData["EndGameTime"])$isShowScore = true;

	$arrGTime = explode(":", $arrGData["GameTime"]);
	$arrGDate = explode("-", $arrGData["GameDate"]);
	$intGTime = mktime($arrGTime[0], $arrGTime[1], $arrGTime[2], $arrGDate[1], $arrGDate[2], $arrGDate[0]) - time();
	if($arrGData["GameDate"] < $NowDate)$isShow = false;
	$EndGameTime = ((int)$_data["isSpecial"] == 1)?$arrGData["EndGameTimeSN"]:$arrGData["EndGameTime"];
	if($arrGData["GameDate"] == $NowDate && $EndGameTime < $NowTime)$isShow = false;
	if(!is_array($_arrTodayGame[$intGID])){
		$isShow = false;
	}
}

$isAllStopWager = true;
if($isShow){
	while(list($intBID, $arrB) = each($_arrTodayGame[$intGID])){
		while(list($intNID, $Rows) = each($arrB)){
			$intApointNum = $_arrGLineNumToApointNum[$Rows["LottoID"]][$Rows["Bet_Type"]][$Rows["Number"]];
			if($intApointNum == null)$intApointNum = 0;

			$strCon .= "parent.Game".$Rows["Bet_Type"]."[".$Rows["Number"]."]=new Array('".$Rows["Number"]."','".$Rows["OddsID"]."','".($Rows["Odds"]+$_arrGambleType[$Rows["Bet_Type"]][$intApointNum])."','".$Rows["isStopBet"]."');\n";

			if($Rows["isStopBet"] == 0)$isAllStopWager = false;
		}  // while(list($intNID, $Rows) = each($arrB))  //
	}  // while(list($intBID, $arrB) = each($_arrTodayGame[$intGID])) //
}  // if($isShow) //

if($isAllStopWager)$isShow = false;
$arrCheckKey = explode(" ", microtime());
/*=================================================================*/
header("Cache-Control: no-store, no-cache, must-revalidate");	  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");															  // HTTP/1.0
?><script language="JavaScript">
<!--
<?php print $strCon;?>
parent.strGameTime = "<?php print $intGTime;?>";
parent.strGameNo = "<?php print $arrGData["SerialNo"];?>";
parent.strChinaTime = "<?php print DateForm(date("Y-m-d"), date("H:i:s"), "m-d", "UToC")." ".TimeForm(date("Y-m-d"), date("H:i:s"), "H:i:s", "UToC");?>";
parent.strCheckKey1 = "<?php print $arrCheckKey[0];?>";
parent.strCheckKey2 = "<?php print $arrCheckKey[1];?>";
<?php if($isShow){ ?>parent.Show10MNOdds_C(<?php print $_data["isSpecial"];?>);<?php } ?>
parent.strDisplay = "none";
//-->
</script>